#引用镜
FROM  node:latest
#FROM node:18.16-slim
#执行命令，创建文件夹
RUN mkdir -p /usr/src/server-fresh

COPY . /usr/src/server-fresh

#指定工作目录
WORKDIR /usr/src/server-fresh

RUN npm config set registry http://mirrors.cloud.tencent.com/npm/

# RUN npm install yarn
#安装依赖及构建node应用
RUN yarn cache clean && yarn --network-timeout 10000

#配置环境变量
ENV HOST 0.0.0.0
ENV PORT 5101
#定义程序默认端口
EXPOSE 5101

RUN yarn ci
#运行程序命令
CMD ["yarn", "run", "start"]